//
// Created by Administrator on 2024/6/11.
// 递归求数组最大值
// https://blog.csdn.net/inshixu/article/details/80154614
//

#include <iostream>
#include <vector>

using namespace std;

int find_max(vector<int> l, int n, int max)
{
    if (n>=0)
    {
        if (l[n]>max)
            max=l[n];
        return find_max(l,n-1,max);
//        cout<<max<<endl;
    }
    return max;
}

int main()
{
    vector<int> v{1,2,3,4,15,6,1};
    cout<<find_max(v,v.size()-1, v[v.size()-1]);
    return 0;
}